<%@ page import="java.util.List" %>
<%@ page import="cn.edu.lingnan.pojo.Participation" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="../js/participation.js"></script>
    <link rel="stylesheet" type="text/css" href="../css/Part.css">

</head>

<body>
<header>
    <h1 >个人竞赛信息页面</h1>
    <hr>
</header>

<br><a href="/loginOut" class="link-style">注销</a>
<a href="/main.jsp" class="link-style">返回首页</a>
<div class="container">
    <div id="approvedTable">
        <h2 align="center">个人竞赛信息表</h2>

        <table>
            <tr>
                <th><input type="checkbox" onclick="allcheck(this);"></th>
                <th>记录编号</th>
                <th>学生编号</th>
                <th>比赛编号</th>
                <th>比赛名称</th>
                <th>状态</th>
            </tr>
            <%
                List<Participation> stuPart =(List<Participation>)session.getAttribute("stuPart");
                boolean flag = false;
                String status="";
                // 循环输出数据
                if (stuPart != null && !stuPart.isEmpty()) {
                    for(Participation participation:stuPart){
                        // 状态为0表示待审批,1为已经审批，2拒绝审批
                            flag = true;//表示有数据，若遍历所有数据条件不成立的话，这个语句不会执行
                            if(participation.getStatus() == 0){
                                status="待审批";
                            } else if (participation.getStatus()==1) {
                                status="已审批";
                            }else status="审批拒绝";
            %>
            <tr>
                <td><input type="checkbox" name="check" value=<%=participation.getId()%>></td>
                <td><%=participation.getId()%></td>
                <td><%=participation.getStudent_id()%></td>
                <td><%=participation.getCompetition_id()%></td>
                <td><%=participation.getCompetition_name()%></td>
                <td><%=status%></td>
            </tr>
            <%

                    }
                }
            %>
        </table>
        <%
            if(!flag) { // 表格为空,flag=ture语没有被执行，则！flag成功执行，显示图片
        %>
        <img src="/images/entry2.png" alt="空空如也">
        <%
            }
        %>
    </div>
</div>


</body>
</html>